home *** CD-ROM | disk | FTP | other *** search
- property xOrigin, yOrigin, xExtent, yExtent, myHeight, mySpriteNum, myCastNumber, myLines, myConfigFile, myFileOffset, myFileSpan, myConfigText, myLevel, myTileSpriteNum, tileXOrigin, tileYOrigin, myTileCastNum, myFontAspectRatio, myTileWidth, myTextVOffset, myTrunk
- global menuList, workingdb, NetscapePathMac, hd
-
- on birth me, theSpriteNum, theHeight, theConfigFile, theFileOffset, theFileSpan, theLevel, theTileSprite, theFontRatio, theTileWidth, theTextVOffset, theTrunk
- set myLevel to theLevel
- set mySpriteNum to theSpriteNum
- set myCastNumber to the castNum of sprite mySpriteNum
- set myTileSpriteNum to theTileSprite
- set myTileCastNum to the castNum of sprite myTileSpriteNum
- set myFontAspectRatio to theFontRatio
- set myTileWidth to theTileWidth
- set myTextVOffset to theTextVOffset
- set myTrunk to theTrunk
- set xExtent to 10
- set myHeight to theHeight
- set myConfigFile to theConfigFile
- resetValues(me, theFileOffset, theFileSpan)
- hideObject(me)
- return me
- end
-
- on resetValues me, theFileOffset, theFileSpan
- set myFileOffset to theFileOffset
- set myFileSpan to theFileSpan
- set myConfigText to EMPTY
- decodeConfigFile(me)
- end
-
- on decodeConfigFile me
- if myConfigText = EMPTY then
- set the itemDelimiter to TAB
- set Obj to FileIO(mnew, "read", the pathName & myConfigFile)
- if not objectp(Obj) then
- alert("no oggetto" & Obj)
- end if
- set myConfigText to Obj(mReadFile)
- Obj(mdispose)
- end if
- set the text of cast myCastNumber to EMPTY
- repeat with a = 1 to myFileSpan
- put item 1 of line a + myFileOffset - 1 of myConfigText & RETURN after line a of field myCastNumber
- end repeat
- put line 1 to the number of lines in field myCastNumber - 1 of field myCastNumber into field myCastNumber
- end
-
- on verticalSynch me
- set the textHeight of field myCastNumber to myHeight
- set yExtent to (the number of lines in field myCastNumber * myHeight) - myTrunk
- end
-
- on horizontalSynch me
- tileSynch(me)
- set xExtent to integer(findMaxCharsInLine() * the textSize of field myCastNumber * myFontAspectRatio)
- end
-
- on tileSynch me
- set tileXOrigin to ((xOrigin / myTileWidth) + 1) * myTileWidth
- set xOrigin to tileXOrigin + myTileWidth
- set tileYOrigin to yOrigin / myHeight * myHeight
- set yOrigin to tileYOrigin + myTextVOffset
- end
-
- on findMaxCharsInLine me
- set maxChar to 0
- repeat with a = 1 to the number of lines in field myCastNumber
- set curChar to the number of chars in line a of field myCastNumber
- if curChar > maxChar then
- set maxChar to curChar
- end if
- end repeat
- return maxChar
- end
-
- on recalcObject me
- verticalSynch(me)
- horizontalSynch(me)
- end
-
- on showObject me
- showTile(me)
- set the rect of cast myCastNumber to rect(xOrigin, yOrigin, xOrigin + xExtent, yOrigin + yExtent)
- set the locH of sprite mySpriteNum to xOrigin
- set the locV of sprite mySpriteNum to yOrigin
- updateStage()
- end
-
- on hideTile
- set the locH of sprite myTileSpriteNum to 1400
- set the locV of sprite myTileSpriteNum to 1400
- end
-
- on hideObject me
- hideTile(me)
- set the locH of sprite mySpriteNum to 1400
- set the locV of sprite mySpriteNum to 1400
- updateStage()
- end
-
- on showTile me
- spriteBox(myTileSpriteNum, tileXOrigin, tileYOrigin, tileXOrigin + myTileWidth, tileYOrigin + yExtent)
- end
-
- on positionObject me, xPos, yPos
- decodeConfigFile(me)
- puppetSprite(mySpriteNum, 1)
- puppetSprite(myTileSpriteNum, 1)
- set xOrigin to xPos
- set yOrigin to yPos
- recalcObject(me)
- showObject(me)
- end
-
- on hideRight me
- repeat with a = myLevel + 1 to count(menuList)
- hideObject(getAt(menuList, a))
- end repeat
- end
-
- on showChild me, theLineNumber
- set nextOffset to item 2 of line myFileOffset + theLineNumber - 1 of myConfigText
- if nextOffset = 0 then
- giacomo(me, theLineNumber)
- else
- set nextObj to getAt(menuList, myLevel + 1)
- set nextSpan to item 3 of line myFileOffset + theLineNumber - 1 of myConfigText
- set nextX to xOrigin + xExtent
- set nextY to yOrigin + ((theLineNumber - 1) * myHeight)
- resetValues(nextObj, nextOffset, nextSpan)
- positionObject(nextObj, nextX, nextY)
- end if
- end
-
- on clickedObject me, theLineNumber
- hideRight(me)
- showChild(me, theLineNumber)
- end
-
- on giacomo me, theLineNumber
- if the machineType = 256 then
- set root to char 1 to 2 of the pathName
- set pathSeparator to "\"
- else
- set pathSeparator to ":"
- set root to char 1 to 5 of the pathName
- end if
- set folderName to item 6 of line myFileOffset + theLineNumber - 1 of myConfigText
- set subType to item 5 of line myFileOffset + theLineNumber - 1 of myConfigText
- put "subType " & subType
- set target to root & pathSeparator & "IMM" & pathSeparator
- if subType = "DB" then
- set target to target & subType & pathSeparator & subType
- set workingdb to value(item 3 of line myFileOffset + theLineNumber - 1 of myConfigText)
- go(1, target)
- else
- if subType = "DN" then
- set target to target & subType & pathSeparator & folderName & pathSeparator & "index.htm"
- nonloso(me, target)
- else
- if char 1 to 2 of subType = "Mv" then
- set target to target & "mv" & pathSeparator & folderName & pathSeparator & subType
- go(1, target)
- else
- set target to target & subType & pathSeparator & folderName & pathSeparator & subType
- go(1, target)
- end if
- end if
- end if
- end
-
- on nonloso me, target
- if the machineType = 256 then
- OpenDN(target)
- else
- set obj1 to FileIO(mnew, "read", hd & "IMM.ini")
- if not objectp(obj1) then
- set temp to "none"
- else
- set temp to obj1(mReadFile)
- put temp & "temp"
- put obj1(mdispose)
- end if
- if line 1 of temp = "none" then
- alert("Per favore trova il tuo Browser HTML")
- set obj2 to FileIO(mnew, "?read", "APPL")
- if not objectp(obj2) then
- alert("hai scelto di non configurare un browser HTML")
- return
- end if
- set netscapeMacPath to obj2(mFileName)
- set obj3 to FileIO(mnew, "write", hd & "IMM.ini")
- put obj3(mWriteString, netscapeMacPath)
- put obj2(mdispose)
- put obj3(mdispose)
- else
- set netscapeMacPath to temp
- end if
- put target
- put netscapeMacPath
- open(target, netscapeMacPath)
- end if
- end
-